package com.blue.base.oauth.server.service;

import com.blue.base.oauth.server.entity.OauthClientDetails;
import com.blue.base.oauth.server.mappers.OAuthClientDetailsMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 此处不需要getByClientId的方法，因为我们注入了[JdbcClientDetailsService]对象
 *
 * @author liulei
 * @version 1.0
 */
@Service
public class OAuthClientDetailsService {

    @Autowired
    private OAuthClientDetailsMapper clientDetailsMapper;

    /**
     * 获取客户端信息
     *
     * @param clientDetails 客户端信息
     */
    public int save(OauthClientDetails clientDetails) {
        return clientDetailsMapper.insert(clientDetails);
    }

    /**
     * 获取客户端信息
     *
     * @param clientId 客户端ID
     */
    public int delete(String clientId) {
        return clientDetailsMapper.deleteById(clientId);
    }
}
